package top.api.controller;

import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.api.common.ResUlt;
import top.api.domain.dto.SysUserInfoLoginDto;
import top.api.service.UserInfoService;
import top.api.service.loginUserInfoService;

import javax.validation.constraints.NotBlank;

/**
* @Description: 仿微信的登录功能
* @Param:
* @return:
* @Author: zqh
* @Date: 2024/5/27
*/

@RestController
@RequestMapping("/account")
@AllArgsConstructor
public class userInfoLoginController {
    private  final loginUserInfoService loginUserInfoService;

    @PostMapping("/login")
    @ApiOperation("用户登录接口")
    public ResUlt<Object> login(@RequestBody @Validated SysUserInfoLoginDto sysUserInfoLoginDto){
        return loginUserInfoService.login(sysUserInfoLoginDto);
    }


    @PostMapping("/register")
    @ApiOperation("/用户注册功能")
    public ResUlt<Object> register(@RequestBody @Validated SysUserInfoLoginDto sysUserInfoLoginDto){
        return loginUserInfoService.register(sysUserInfoLoginDto);
    }
}
